{% extends "auth-menu.html" %}
{% load tag %}
{% block head %}
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
  <style type="text/css">
    html,body{
        margin:0;
        width:100%;
        height:100%;
        background:#ffffff;
    }
{#    #map{#}
{#        width:100%;#}
{#        height:100%;#}
{#        top:20%;#}
{#        left:20%;#}
{#    }#}
    #panel {
        position: absolute;
        top:30px;
        left:10px;
        z-index: 999;
        color: #fff;
    }
    #login{
        position:absolute;
        width:300px;
        height:40px;
        left:50%;
        top:50%;
        margin:-40px 0 0 -150px;
    }
    #login input[type=password]{
        width:200px;
        height:30px;
        padding:3px;
        line-height:30px;
        border:1px solid #000;
    }
    #login input[type=submit]{
        width:80px;
        height:38px;
        display:inline-block;
        line-height:38px;
    }
  </style>
  <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=krejNXU0gOAVoRnoGTDczzDrvryBXnmM"></script>
{#	<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>#}

{#  没有需要加载的文件#}
 {% endblock %}

{% block display_event %}
    "display: block"
{% endblock %}

{% block active_event %}
    'active'
{% endblock %}

{% block active_event_inter %}
    'active'
{% endblock %}

{% block main %}
{#   <div class='span12'>#}
{#        <div class='page-header'>#}
{#            <h1 class='pull-left'>#}
{#                <i class='icon-edit'></i>#}
{#                <span>数据源展示</span>#}
{#            </h1>#}
{#            <div class='pull-right'>#}
{#                <ul class='breadcrumb'>#}
{#                    <li>#}
{#                        <a href="/index"><i class='icon-bar-chart'></i>#}
{#                        </a>#}
{#                    </li>#}
{#                    <li class='separator'>#}
{#                        <i class='icon-angle-right'></i>#}
{#                    </li>#}
{#                    <li>#}
{#                        数据源统计#}
{#                    </li>#}
{#                    <li class='separator'>#}
{#                        <i class='icon-angle-right'></i>#}
{#                    </li>#}
{#                    <li class='active'>货运数据源</li>#}
{#                </ul>#}
{#            </div>#}
{#        </div>#}
{#    </div>#}

{#   <div class='span12'>#}
{#            <h4 class='pull-left'>#}
{#                <form accept-charset="utf-8" class="navbar-search pull-left hidden-phone" method="get" />#}
{#                    <div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>#}
{#                              数据源：#}
{#                                        <select id='inputSelect' name="source" style="width:100px;" >#}
{#                                        {% for i in source_list %}#}
{#                                            <option {{ i.select }}/>{{ i.source | code_gbk }}#}
{#                                        {% endfor %}#}
{#                                        </select>#}
{#                <button class="btn btn-link icon-search " name="button" type="submit"></button>#}
{#            </h4>#}
{##}
{#            <h4 div class='pull-left'>#}
{#               &nbsp &nbsp &nbsp城市:{{ cityname }} &nbsp 时间:{{ time_str }}&nbsp  TIMEID:{{ timeid }} &nbsp 车辆数:{{ cars }} &nbsp GPS量:{{ data_total }}&nbsp 平均上传间隔:{{ interval}}秒#}
{##}
{#            </h4>#}
{#    </div>#}
{#{% for i in  inter_event_list %}#}
{#    {% print i %}#}
{#    {{ i.lng }}#}
{#    {{ i.lat }}#}
{#    {{ i.remark }}#}
{#{% endfor %}#}

<div id="map" style="width: 1200px;height:800px;"></div>
<script type="text/javascript">
	// 百度地图API功能
	map = new BMap.Map("map");
	map.centerAndZoom(new BMap.Point(113.417854,35.921988), 5);

    map.enableScrollWheelZoom();                        //启用滚轮放大缩小
    map.addControl(new BMap.MapTypeControl());
    map.disable3DBuilding();

{#	var data_info = [[116.417854,39.921988,"地址：北京市东城区王府井大街88号乐天银泰百货八层"],#}
{#					 [116.406605,39.921585,"地址：北京市东城区东华门大街   </br>    磊"],#}
{#					 [116.412222,39.912345,"地址：北京市东城区正义路甲5号"]#}
{#					];#}
{#    var data_info = {{ inter_event_list | safe}};#}
	var opts = {
				width : 250,     // 信息窗口宽度
				height: 120,     // 信息窗口高度
{#				title : "信息窗口" , // 信息窗口标题#}
				enableMessage:true//设置允许信息窗发送短息
			   };
{#    for(var i=0;i<data_info.length;i++){#}
{#		var marker = new BMap.Marker(new BMap.Point(data_info[i][0],data_info[i][1]));  // 创建标注#}
{#		var content = data_info[i][2];#}
{#		map.addOverlay(marker);               // 将标注添加到地图中#}
{#		addClickHandler(content,marker);#}
{#	}#}
{#    #}
    {% for data_info in inter_event_list %}
        var marker = new BMap.Marker(new BMap.Point({{ data_info.lng }},{{ data_info.lat }}));  // 创建标注
		var content = "{{ data_info.remark|safe }}";
		map.addOverlay(marker);               // 将标注添加到地图中
		addClickHandler(content,marker);
    {% endfor %}
	function addClickHandler(content,marker){
		marker.addEventListener("click",function(e){
			openInfo(content,e)}
		);
	}
	function openInfo(content,e){
		var p = e.target;
		var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
		var infoWindow = new BMap.InfoWindow(content,opts);  // 创建信息窗口对象
		map.openInfoWindow(infoWindow,point); //开启信息窗口
	}
</script>
{% endblock %}
{% block script %}
{#    <script type="text/javascript" src="http://developer.baidu.com/map/custom/stylelist.js"></script>#}
{% endblock %}
